//
//  DeliveryDetailView.m
//  HAODE
//
//  Created by panquanReabam.com on 16/5/26.
//  Copyright © 2016年 reabam.com. All rights reserved.
//

#import "DeliveryDetailView.h"
#import "GoodsView.h"

@interface DeliveryDetailView()
@property(nonatomic,strong)UIView*orderView;

@property(nonatomic,strong)UIView*sendView;
@property(nonatomic,strong)UIView*noView;
@property(nonatomic,strong)UIView*memberView;
@property(nonatomic,strong)UILabel*stateLabel;
@property(nonatomic,strong)UILabel*stateLabel1;
@property(nonatomic,strong)UILabel*stateLabel2;
@property(nonatomic,strong)UILabel*orderNoLabel;
@property(nonatomic,strong)UILabel*source;
@property(nonatomic,strong)UILabel*sourceLabel;
@property(nonatomic,strong)UILabel*orderDate;
@property(nonatomic,strong)UILabel*orderDateLabel;

@property(nonatomic,strong)UILabel*orderNoLabel1;
@property(nonatomic,strong)UILabel*source1;
@property(nonatomic,strong)UILabel*sourceLabel1;
@property(nonatomic,strong)UILabel*orderDate1;
@property(nonatomic,strong)UILabel*orderDateLabel1;

@property(nonatomic,strong)UILabel*memberName;
@property(nonatomic,strong)UILabel*memberNameLabel;
@property(nonatomic,strong)UILabel*address;
@property(nonatomic,strong)UILabel*addressLabel;
@property(nonatomic,strong)UIImageView*sexImage;
@property(nonatomic,strong)UILabel*consignee;
@property(nonatomic,strong)UILabel*consigneeLabel;
@property(nonatomic,strong)UILabel*levelLabel;
@property(nonatomic,strong)UILabel*level;
@property(nonatomic,strong)UIView*orderItemView;
@property(nonatomic,strong)UIButton*jiantouBtn;
@property(nonatomic,strong)UILabel*sendInfo;
@property(nonatomic,strong)UILabel*send;
@property(nonatomic,strong)UILabel*freight;
@property(nonatomic,strong)UILabel*sendLabel;
@property(nonatomic,strong)UILabel*freightLabel;
@end
@implementation DeliveryDetailView
{
    
    GoodsView*goodsView;
    
    NSMutableArray*orderItemArray;
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        
    }
    return self;
}
#pragma mark InitUI
- (void)initUI
{
    self .backgroundColor = [UIColor whiteColor];
    _orderView=[[UIView alloc]init];
    _orderView.backgroundColor=[UIColor whiteColor];
    [self addSubview:_orderView];
    
    _noView=[[UIView alloc]init];
    _noView.backgroundColor=[UIColor whiteColor];
    [_orderView addSubview:_noView];
    
    _memberView=[[UIView alloc]init];
    _memberView.backgroundColor=[UIColor whiteColor];
    [_orderView addSubview:_memberView];
    
    _sendView=[[UIView alloc]init];
    _sendView.backgroundColor=[UIColor whiteColor];
    [_orderView addSubview:_sendView];
    _orderNoLabel=[[UILabel alloc]init];
    _orderNoLabel.textColor=[UIColor blackColor];
    _orderNoLabel.font=[UIFont systemFontOfSize:17];
    [self addSubview:_orderNoLabel];
    
    
    _stateLabel=[[UILabel alloc]init];
    _stateLabel.textColor=luseColor;
    self.stateLabel.textAlignment=NSTextAlignmentCenter;
    _stateLabel.font=[UIFont systemFontOfSize:Statusfot];
    [self addSubview:_stateLabel];
    
    
    _stateLabel1=[[UILabel alloc]init];
    _stateLabel1.textColor=luseColor;
    _stateLabel1.font=[UIFont systemFontOfSize:Statusfot];
    [self addSubview:_stateLabel1];
    
    _stateLabel2=[[UILabel alloc]init];
    _stateLabel2.textColor=luseColor;
    _stateLabel2.font=[UIFont systemFontOfSize:Statusfot];
    [self addSubview:_stateLabel2];
    
    
    _source=[[UILabel alloc]init];
    _source.text=[NSString stringWithFormat:@"来源"];
    _source.textColor=zhonghuiColor;
    _source.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_source];
    
    _sourceLabel=[[UILabel alloc]init];
    _sourceLabel.textColor=shenhuiColor;
    _sourceLabel.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_sourceLabel];
    _orderDate=[[UILabel alloc]init];
    _orderDate.textColor=zhonghuiColor;
    _orderDate.text=[NSString stringWithFormat:@"时间"];
    _orderDate.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_orderDate];

    _orderDateLabel=[[UILabel alloc]init];
    _orderDateLabel.textColor=shenhuiColor;
    _orderDateLabel.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_orderDateLabel];
    
    
    
    _memberName=[[UILabel alloc]init];
    _memberName.textColor=qianheiColor;
    _memberName.text=@"订单信息";
    _memberName.font=[UIFont systemFontOfSize:15];
    [self addSubview:_memberName];
    _orderNoLabel1=[[UILabel alloc]init];
    _orderNoLabel1.textColor=[UIColor blackColor];
    _orderNoLabel1.font=[UIFont systemFontOfSize:17];
    [self addSubview:_orderNoLabel1];
    _source1=[[UILabel alloc]init];
    _source1.text=[NSString stringWithFormat:@"来源"];
    _source1.textColor=zhonghuiColor;
    _source1.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_source1];
    
    _sourceLabel1=[[UILabel alloc]init];
    _sourceLabel1.textColor=shenhuiColor;
    _sourceLabel1.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_sourceLabel1];
    
    
    _orderDate1=[[UILabel alloc]init];
    _orderDate1.textColor=zhonghuiColor;
    _orderDate1.text=[NSString stringWithFormat:@"下单时间"];
    _orderDate1.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_orderDate1];

    _orderDateLabel1=[[UILabel alloc]init];
    _orderDateLabel1.textColor=shenhuiColor;
    _orderDateLabel1.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_orderDateLabel1];
    
    
   
    _sendInfo=[[UILabel alloc]init];
    _sendInfo.textColor=qianheiColor;
    _sendInfo.text=@"配送信息";
    _sendInfo.font=[UIFont systemFontOfSize:15];
    [self addSubview:_sendInfo];
    
    _send=[[UILabel alloc]init];
    _send.textColor=shenhuiColor;
    _send.text=@"配送方式";
    _send.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_send];
    
    _sendLabel=[[UILabel alloc]init];
    _sendLabel.textColor=qianheiColor;
    _sendLabel.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_sendLabel];
    
    
    _freight=[[UILabel alloc]init];
    _freight.textColor=shenhuiColor;
    _freight.text=@"运费";
    _freight.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_freight];
    _freightLabel=[[UILabel alloc]init];
    _freightLabel.textColor=qianheiColor;
    _freightLabel.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_freightLabel];
    
    _consignee=[[UILabel alloc]init];
    _consignee.textColor=shenhuiColor;
    _consignee.text=@"收货人";
    _consignee.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_consignee];
    _consigneeLabel=[[UILabel alloc]init];
    _consigneeLabel.textColor=qianheiColor;
    _consigneeLabel.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_consigneeLabel];
    
    _address=[[UILabel alloc]init];
    _address.textColor=shenhuiColor;
    _address.text=@"收货地址";
    _address.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_address];
    
    _addressLabel=[[UILabel alloc]init];
    _addressLabel.textAlignment=NSTextAlignmentRight;
    _addressLabel.textColor=qianheiColor;
    _addressLabel.numberOfLines=0;
    _addressLabel.font=[UIFont systemFontOfSize:contenfot];
    [self addSubview:_addressLabel];
    
    _orderItemView=[[UIView alloc]init];
    _orderItemView.backgroundColor=[UIColor whiteColor];
    [self addSubview:_orderItemView];
    
   
    
    UIImageView *_xianview = [[UIImageView alloc]initWithFrame:CGRectMake(10,70+10+45, ScreenWidth-20, 0.5)];
    _xianview.image=[UIImage imageNamed:@"hengxian"];
    [self addSubview:_xianview];
//    UILabel *line=[[UILabel alloc] initWithFrame:CGRectMake(0,0, ScreenWidth, 0.40)];
//    line.backgroundColor=qianhuiColor;
//    [_orderItemView addSubview:line];
    
    
    UILabel*shangpingxinxi=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, 80, 45)];
    shangpingxinxi.text=@"商品信息";
    shangpingxinxi.textColor=qianheiColor;
    shangpingxinxi.font=[UIFont systemFontOfSize:15];
    [_orderItemView addSubview:shangpingxinxi];
    UILabel *lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(10, 45-0.40, ScreenWidth-20, 0.40)];
    lineLabel.backgroundColor=qianhuiColor;
    [_orderItemView addSubview:lineLabel];
    
    
    UIView*view=[[UIView alloc]initWithFrame:CGRectMake(0, 70, ScreenWidth, 10)];
    view.backgroundColor=zuiqianhuiColor;
    view.layer.borderColor = qianhuiColor.CGColor;
    [view.layer setBorderWidth:0.40];   //边
    [self addSubview:view];
   
    UIView*view1=[[UIView alloc]initWithFrame:CGRectMake(0, 80+45+70, ScreenWidth, 10)];
    view1.backgroundColor=zuiqianhuiColor;
    view1.layer.borderColor = qianhuiColor.CGColor;
    [view1.layer setBorderWidth:0.40];   //边
    [self addSubview:view1];
    
    UIView*view2=[[UIView alloc]initWithFrame:CGRectMake(0, 80+45+70+10+165, ScreenWidth, 10)];
    view2.backgroundColor=zuiqianhuiColor;
    view2.layer.borderColor = qianhuiColor.CGColor;
    [view2.layer setBorderWidth:0.45];   //边
    [self addSubview:view2];
  
    _heightView=[[UIView alloc]init];
    [self addSubview:_heightView];
}


-(void)setDeliveryModel:(DeliveryDetailModel *)DeliveryModel{
    [self initUI];
    [self setViewAutoLayout];
    self.orderNoLabel.text=[NSString stringWithFormat:@"%@", [[DeliveryModel.dict objectForKey:@"delivery"] objectForKey:@"deliveryNo"]];
  
    if ([[NSString stringWithFormat:@"%@",  [[DeliveryModel.dict objectForKey:@"delivery"] objectForKey:@"deliveryStatus"]] isEqualToString:@"Y"]) {
        self.stateLabel.textColor=[UIColor whiteColor];
        self.stateLabel.backgroundColor=luseColor;
        self.stateLabel.font=[UIFont systemFontOfSize:11];
        self.stateLabel.text=[NSString stringWithFormat:@"%@", @"配送 "];
    }else{
        self.stateLabel.font=[UIFont systemFontOfSize:11];
        self.stateLabel.textColor=[UIColor whiteColor];
        self.stateLabel.backgroundColor=orangeCol;
        self.stateLabel.text=[NSString stringWithFormat:@"%@", @"自提 "];
    }
    
    if ([[NSString stringWithFormat:@"%@",  [[DeliveryModel.dict objectForKey:@"delivery"] objectForKey:@"deliveryStatus"]] isEqualToString:@"Y"]) {
        self.stateLabel1.textColor=shenhongseColor;
    }
    if ([[NSString stringWithFormat:@"%@",  [[DeliveryModel.dict objectForKey:@"delivery"] objectForKey:@"deliveryStatus"]] isEqualToString:@"F"]) {
        self.stateLabel1.textColor=luseColor;
        
    }
    self.stateLabel1.text=[NSString stringWithFormat:@"%@",  [[DeliveryModel.dict objectForKey:@"delivery"] objectForKey:@"deliveryStatusName"]];
    self.sourceLabel.text=[NSString stringWithFormat:@"%@",  [[DeliveryModel.dict objectForKey:@"delivery"] objectForKey:@"source"]];
//    NSRange range={0,10};
    NSString* string = [[DeliveryModel.dict objectForKey:@"delivery"] objectForKey:@"deliveryDate"] ;
    self.orderDateLabel.text=[NSString stringWithFormat:@"%@",   string];
    
    
   
    self.orderNoLabel1.text=[NSString stringWithFormat:@"%@", [[DeliveryModel.dict objectForKey:@"order"] objectForKey:@"orderNo"]];
   
  
    self.sourceLabel1.text=[NSString stringWithFormat:@"%@",  [[DeliveryModel.dict objectForKey:@"order"] objectForKey:@"source"]];
    NSRange range1={0,10};
    NSString* string1 =[ [[DeliveryModel.dict objectForKey:@"order"] objectForKey:@"orderDate"] substringWithRange:range1];
    self.orderDateLabel1.text=[NSString stringWithFormat:@"%@",   string1];

    if ([[NSString stringWithFormat:@"%@",  [[DeliveryModel.dict objectForKey:@"order"] objectForKey:@"deliveryType"]]isEqualToString:@"shsm"]) {
        self.consigneeLabel.text=[NSString stringWithFormat:@"%@(%@)", [[DeliveryModel.dict objectForKey:@"send"] objectForKey:@"consignee"],[[DeliveryModel.dict objectForKey:@"send"] objectForKey:@"phone"]];
        self.sendLabel.text= [NSString stringWithFormat:@"%@",@"快递配送"];
        self.freightLabel.text= [NSString stringWithFormat:@"¥ %@", [[DeliveryModel.dict objectForKey:@"order"] objectForKey:@"expressFee"]];
        self.addressLabel.text=[NSString stringWithFormat:@"%@",  [[DeliveryModel.dict objectForKey:@"send"] objectForKey:@"address"]];
        self.addressLabel.numberOfLines=0;
        
    }else{
        self.sendLabel.text= [NSString stringWithFormat:@"%@",@"到店自提"];
        self.freight.text=@"提货日期";
        self.consignee.text=@"提货门店";
         self.freightLabel.text= [NSString stringWithFormat:@"%@", [[DeliveryModel.dict objectForKey:@"delivery"] objectForKey:@"deliveryDate"]];
        self.consigneeLabel.text=[NSString stringWithFormat:@"%@", [[DeliveryModel.dict objectForKey:@"delivery"] objectForKey:@"companyName"]];
        
        self.addressLabel.text=[NSString stringWithFormat:@"%@",  [[DeliveryModel.dict objectForKey:@"delivery"] objectForKey:@"companyAddress"]];
        self.addressLabel.numberOfLines=0;

    
    }
    
    orderItemArray=[DeliveryModel.dict objectForKey:@"orderItem"];
    if (orderItemArray.count>0) {
        for (int i = 0; i<orderItemArray.count; i++) {
            goodsView = [[GoodsView alloc]initWithFrame:CGRectMake(0,80+45+70+10+165+10+45+(120*i), ScreenWidth, 120)];
            goodsView.backgroundColor=[UIColor whiteColor];
            [goodsView.headImageFull setImageWithURL:[[orderItemArray objectAtIndex:i] objectForKey:@"headImageFull"] placeholderImage:[UIImage imageNamed:@"zhengfangxing"]];
            [goodsView.headImageFull.layer setCornerRadius:5.0];
            [goodsView.headImageFull.layer setBorderWidth:0.3];
            [goodsView.headImageFull.layer setMasksToBounds:YES];
            CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
            CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){ 0.93, 0.93, 0.93, 0.93 });
            [goodsView.headImageFull.layer setBorderColor:colorref2];//边框颜色
            goodsView.itemName.text=[NSString stringWithFormat:@"%@ %@",[[orderItemArray objectAtIndex:i] objectForKey:@"itemCode"],[[orderItemArray objectAtIndex:i] objectForKey:@"itemName"]];
            goodsView.quantity.text=[NSString stringWithFormat:@"数量 %@",[[orderItemArray objectAtIndex:i] objectForKey:@"thisQty"]];
            
            NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
            [numberFormatter setPositiveFormat:@"###,##0.00;"];
            NSString *formattedNumberString = [numberFormatter stringFromNumber:[[orderItemArray objectAtIndex:i] objectForKey:@"dealPrice"]];
            goodsView.dealPrice.text=[NSString stringWithFormat:@"¥ %@",formattedNumberString];
            goodsView.dealPrice.textColor=[UIColor blackColor];
            goodsView.dealPrice.font=[UIFont systemFontOfSize:16];
            NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"¥ %@" ,formattedNumberString]];
            
            [AttributedStr addAttribute:NSFontAttributeName
             
                                  value:[UIFont systemFontOfSize:14]
             
                                  range:NSMakeRange(0, 1)];
            
            [AttributedStr addAttribute:NSForegroundColorAttributeName
             
                                  value:shenhuiColor
             
                                  range:NSMakeRange(0, 1)];
            goodsView.dealPrice.attributedText = AttributedStr;
            goodsView.itemType.text=[NSString stringWithFormat:@"%@",[[orderItemArray objectAtIndex:i] objectForKey:@"specName"]];
            
            
            if (orderItemArray.count==i+1) {
                
            }else{
            
            UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(10, 120-0.40, ScreenWidth-20, 0.40)];
            lineLabel1.backgroundColor=qianhuiColor;
            [goodsView addSubview:lineLabel1];
            }
            [self addSubview:goodsView];
            
       
        }
        _heightView.frame=CGRectMake(0, goodsView.bottom, ScreenWidth, 10);
        _heightView.backgroundColor=zuiqianhuiColor;
        _heightView.layer.borderColor = qianhuiColor.CGColor;
        [_heightView.layer setBorderWidth:0.4];   //边
        
        
        NSNumber*Total = [[DeliveryModel.dict objectForKey:@"delivery"]objectForKey:@"totalMoney"];
        NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
        [numberFormatter setPositiveFormat:@"###,##0.00;"];
        NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:Total.doubleValue]];
        UILabel*totalQuantity=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-250, 0, 230, 45)];
        totalQuantity.text=[NSString  stringWithFormat:@"共 %@ 件，  ￥%@",[[DeliveryModel.dict objectForKey:@"delivery"]objectForKey:@"totalQuantity"], formattedNumberString];
        totalQuantity.textColor = [UIColor colorWithRed:5.00/255.0 green:18.0/255.0 blue:40.00/255.0 alpha:1];
        totalQuantity.textAlignment = NSTextAlignmentRight;
        totalQuantity.font = [UIFont systemFontOfSize:16];
        NSMutableAttributedString *AttributedStr2 = [[NSMutableAttributedString alloc]initWithString:[NSString  stringWithFormat:@"共 %@ 件，  ￥%@",[[DeliveryModel.dict objectForKey:@"delivery"]objectForKey:@"totalQuantity"], formattedNumberString]];
        [AttributedStr2 addAttribute:NSFontAttributeName
         
                               value:[UIFont systemFontOfSize:13.0]
         
                               range:NSMakeRange(0, 8)];
        
        [AttributedStr2 addAttribute:NSForegroundColorAttributeName
         
                               value:zhonghuiColor
         
                               range:NSMakeRange(0, 8)];
        
        
        totalQuantity.attributedText = AttributedStr2;
        [_orderItemView addSubview:totalQuantity];

        
    }else{
        
        UILabel*shangpingxinxi=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-120, 0, 105, 44)];
        shangpingxinxi.text=@"自定义商品";
        shangpingxinxi.textColor=shenhuiColor;
        shangpingxinxi.textAlignment=NSTextAlignmentRight;
        shangpingxinxi.font=[UIFont systemFontOfSize:15];
        [_orderItemView addSubview:shangpingxinxi];
        
        _heightView.frame=CGRectMake(0, 370+10+45, ScreenWidth, 0.15);
        
    }
}

-(void)setViewAutoLayout
{
    [self.orderView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(0) ;
        make.height.equalTo(@490);
        make.top.equalTo(self.mas_top).with.offset(0);
    }];
    [self.orderNoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@17);
        make.top.equalTo(self.mas_top).with.offset(15);
    }];
    [self.noView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(0) ;
        make.height.equalTo(@70);
        make.top.equalTo(self.mas_top).with.offset(0);
    }];
    [self.memberView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(0) ;
        make.height.equalTo(@115);
        make.top.equalTo(self.mas_top).with.offset(80);
    }];
    
    [self.sendView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(0) ;
        make.height.equalTo(@165);
        make.top.equalTo(self.mas_top).with.offset(80+45+70+10);
    }];
    
    
    [self.stateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.orderNoLabel.mas_right).with.offset(7.5);
        make.height.equalTo(@13);
        
        make.centerY.equalTo(self.orderNoLabel.mas_centerY) ;
    }];
    [self.stateLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.stateLabel.mas_right).with.offset(5);
        make.height.equalTo(@13);
        
        make.centerY.equalTo(self.orderNoLabel.mas_centerY) ;
    }];
    [self.stateLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.stateLabel1.mas_right).with.offset(5);
        make.height.equalTo(@13);
        
        make.centerY.equalTo(self.orderNoLabel.mas_centerY) ;
    }];
    
    [self.source mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.orderNoLabel.mas_bottom).with.offset(10);
    }];
    
    [self.sourceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.source.mas_right).with.offset(3);
        make.height.equalTo(@14);
        make.top.equalTo(self.orderNoLabel.mas_bottom).with.offset(10);
    }];
    [self.orderDate mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.sourceLabel.mas_right).with.offset(15) ;
        make.height.equalTo(@14);
        make.centerY.equalTo(self.source.mas_centerY) ;
    }];
    [self.orderDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.orderDate.mas_right).with.offset(3) ;
        make.height.equalTo(@14);
        make.centerY.equalTo(self.source.mas_centerY) ;
    }];
   
    
    [self.memberName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@45);
        make.top.equalTo(self.noView.mas_bottom).with.offset(10);
        
    }];

    [self.orderNoLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@17);
        make.top.equalTo(self.mas_top).with.offset(15+70+45+10);
    }];
    [self.source1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.orderNoLabel1.mas_bottom).with.offset(10);
    }];
    
    [self.sourceLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.source.mas_right).with.offset(3);
        make.height.equalTo(@14);
        make.top.equalTo(self.orderNoLabel1.mas_bottom).with.offset(10);
    }];
    
    [self.orderDate1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.sourceLabel1.mas_right).with.offset(15) ;
        make.height.equalTo(@14);
        make.centerY.equalTo(self.source1.mas_centerY) ;
    }];
    [self.orderDateLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.orderDate1.mas_right).with.offset(3) ;
        make.height.equalTo(@14);
        make.centerY.equalTo(self.source1.mas_centerY) ;
    }];
    [self.sendInfo mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@45);
        make.top.equalTo(self.mas_top).with.offset(135+70);
    }];
    
    [self.send mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15);
        make.height.equalTo(@14);
        make.top.equalTo(self.sendInfo.mas_bottom).with.offset(7);
        
    }];
    
    [self.sendLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).with.offset(-15) ;
        make.height.equalTo(@14);
        make.centerY.equalTo(self.send.mas_centerY) ;
        
    }];
    
    [self.freight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15);
        make.height.equalTo(@14);
        make.top.equalTo(self.send.mas_bottom).with.offset(7);
        
    }];
    
    
    
    [self.freightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).with.offset(-15) ;
        make.height.equalTo(@14);
        make.centerY.equalTo(self.freight.mas_centerY) ;
        
    }];
    
    [self.consignee mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.freight.mas_bottom).with.offset(7);
    }];
    
    [self.consigneeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).with.offset(-15) ;
        make.height.equalTo(@14);
        make.centerY.equalTo(self.consignee.mas_centerY) ;
        
    }];
    
    [self.address mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.consignee.mas_bottom).with.offset(7);
    }];
    
    [self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.address.mas_right).with.offset(15) ;
        make.right.equalTo(self.mas_right).with.offset(-15) ;
        
        make.top.equalTo(self.consignee.mas_bottom).with.offset(7);
        
    }];
    [self.orderItemView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(0);
        make.height.equalTo(@45);
        make.top.equalTo(self.mas_top).with.offset(370+10);
    }];
    
//    80+45+70+10+165
}

@end
